import Vue from 'vue';
import Router from 'vue-router';
import { resolve } from 'url';

Vue.use(Router);

export default new Router({
    routes: [{
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: {
                title: '自述文件'
            },
            children: [{
                    path: '/dashboard',
                    component: resolve => require(['../components/page/Dashboard.vue'], resolve),
                    meta: {
                        title: '系统首页'
                    }
                },
                {
                    path: '/clubuserlist',
                    component: resolve => require(['../views/clubuserlist.vue'], resolve),
                    meta: {
                        title: '俱乐部用户列表',
                        roles: [0]
                    }
                },
                {
                    path: '/verifyuser',
                    component: resolve => require(['../views/verifyuserlist.vue'], resolve),
                    meta: {
                        title: '待审核用户列表',
                        roles: [0]
                    }
                },
                {
                    path: '/clubinfo',
                    component: resolve => require(['../views/clubinfo.vue'], resolve),
                    meta: {
                        title: '俱乐部信息',
                        roles: [0]
                    }
                },
                {
                    path: '/managecoach',
                    component: resolve => require(['../views/managecoach.vue'], resolve),
                    meta: {
                        title: '教练管理',
                        roles: [0]
                    }
                },
                {
                    path: '/trainmanage',
                    component: resolve => require(['../views/trainmanage.vue'], resolve),
                    meta: {
                        title: '训练管理',
                        roles: [0]
                    }
                },
                {
                    path: '/trainorder:myId',
                    component: resolve => require(['../views/trainorder.vue'], resolve),
                    meta: {
                        title: '训练订单',
                        roles: [0]
                    }
                },
                {
                    path: '/coursemanage',
                    component: resolve => require(['../views/coursemanage.vue'], resolve),
                    meta: {
                        title: '课程管理',
                        roles: [0]
                    }
                },
                {
                    path: '/video',
                    component: resolve => require(['../views/video.vue'], resolve),
                    meta: {
                        title: '视频管理',
                        roles: [0]
                    }
                },
                {
                    path: '/matchlist',
                    component: resolve => require(['../views/matchlist.vue'], resolve),
                    meta: {
                        title: '比赛列表',
                        roles: [1]
                    }
                },
                {
                    path: '/sendmatch',
                    component: resolve => require(['../views/sendmatch.vue'], resolve),
                    meta: {
                        title: '发起比赛',
                        roles: [1]
                    }
                },
                {
                    path: '/matchchecklist:myId',
                    component: resolve => require(['../views/matchchecklist.vue'], resolve),
                    meta: {
                        title: '比赛报名列表',
                        roles: [1]
                    }
                },
                {
                    path: '/activitylist',
                    component: resolve => require(['../views/activitylist.vue'], resolve),
                    meta: {
                        title: '活动列表',
                        roles: [1]
                    }
                },
                {
                    path: '/sendactivity',
                    component: resolve => require(['../views/sendactivity.vue'], resolve),
                    meta: {
                        title: '发起活动',
                        roles: [1]
                    }
                },
                {
                    path: '/activitychecklist',
                    component: resolve => require(['../views/activitychecklist.vue'], resolve),
                    meta: {
                        title: '活动报名列表',
                        roles: [1]
                    }
                },
                {
                    path: '/clubmanage',
                    component: resolve => require(['../views/clubmanage.vue'], resolve),
                    meta: {
                        title: '俱乐部管理',
                        roles: [1]
                    }
                },
                {
                    path: '/share',
                    component: resolve => require(['../views/share.vue'], resolve),
                    meta: {
                        title: '晒图管理',
                        roles: [1]
                    }
                },
                {
                    path: '/userlist',
                    component: resolve => require(['../views/userlist.vue'], resolve),
                    meta: {
                        title: '用户列表',
                        roles: [1]
                    }
                },
                {
                    path: '/masterlist',
                    component: resolve => require(['../views/masterlist.vue'], resolve),
                    meta: {
                        title: '大师列表',
                        roles: [1]
                    }
                },
                {
                    path: '/verifymaster',
                    component: resolve => require(['../views/verifymaster.vue'], resolve),
                    meta: {
                        title: '待审核大师列表',
                        roles: [1]
                    }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: resolve => require(['../components/page/Permission.vue'], resolve),
                    meta: {
                        title: '权限测试',
                        permission: true
                    }
                },
                {
                    path: '/404',
                    component: resolve => require(['../components/page/404.vue'], resolve),
                    meta: {
                        title: '404'
                    }
                },
                {
                    path: '/403',
                    component: resolve => require(['../components/page/403.vue'], resolve),
                    meta: {
                        title: '403'
                    }
                }
            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
})
